package com.potenza.training.resume.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.potenza.training.resume.dao.EducationExperienceDao;
import com.potenza.training.resume.entity.EducationExperienceEntity;
import com.potenza.training.resume.service.EducationExperienceService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("educationExperienceService")
public class EducationExperienceServiceImpl extends ServiceImpl<EducationExperienceDao, EducationExperienceEntity> implements EducationExperienceService {

    @Autowired
    EducationExperienceDao educationExperienceDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<EducationExperienceEntity> page = this.page(
                new Query<EducationExperienceEntity>().getPage(params),
                new QueryWrapper<EducationExperienceEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<EducationExperienceEntity> findByresumeId(Integer resumeId) {
        QueryWrapper<EducationExperienceEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(EducationExperienceEntity::getResumeId,resumeId);
        return educationExperienceDao.selectList(queryWrapper);
    }

}